<include file="../Public/header_ajax" />
<form action="{:U('w3g/Index/ajax_image_upload')}" method="post" enctype="multipart/form-data">
		<input type="file" name="file" id="file" class="form-control" accept="image/gif,image.jpg,image/jpeg,image/pjpeg,image/png,image/bmp"/> 
	<div class="hide">
		<input type="text" name="attach_type" id="attach_type" value="feed_image"/>
		<input type="text" name="upload_type" id="upload_type" value="image"/>
        <button type="submit" name="submit" id="doupload" class="hide">上传</button>
	</div>
</form>
<div id="loaded" class="hide">OK</div>
<script type="text/javascript">
fType=new Array('jpg','jpeg','png','bmp','gif');
$(function(){
	$(document).on('change','#file',function(){
		// var file=$('#doupload').val();
		// var fileType=file.substring(file.lastIndexOf('.')+1).toLowerCase();
		// var if_img=false;
		// $.each(fType,function(index,item){
		// 	if(item==fileType){
		// 		if_img=true;
		// 	}
		// });
		// if(if_img){
		// 	$('#attach_type').val('feed_img').data('type','feed_img');
		// 	$('#upload_type').val('image').data('type','image');
		// }else{
		// 	$('#attach_type').val('feed_file').data('type','feed_file');
		// 	$('#upload_type').val('file').data('type','file');
		// }
		$('#doupload').trigger('click');
		window.parent.tips('上传中...',2,0);
	});
	// upload
	$(document).on('click','doupload',function(){
	});
});
</script>
</body>
</html>